/**
 * Created by Freeman on 2016/8/2.
 */

import {authResource,userResource,tagResource,articleResource,commentResource} from './resources'

export default {
    localLogin: function (data) {
        return authResource('post', 'local', data)
    },
    getMe:function (data) {
        return userResource('get','me',data)
    },
    mdUser: function (data) {
        return userResource('put','mdUser',data)
    },
    register:function (data) {
        return userResource('post','addUser',data)
    },
    getTagList:function () {
        return tagResource('get','getFrontTags')
    },
    getArticleList:function (options) {
        return articleResource('get','getFrontArticleList',null,{params:options})
    },
    getFrontArticle:function (id) {
        return articleResource('get',id, 'getFrontArticle')
    },
    getCommentList:function (id) {
        return commentResource('get',id,'getFrontCommentList')
    },
    addNewComment:function (data) {
        return commentResource('post','addNewComment',null,data)
    },
    addNewReply:function (id,data) {
        return commentResource('post',id,'addNewReply',data)
    },
    toggleLike:function (aid) {
        return articleResource('put',aid,'toggleLike')
    },
    addNewArticle:function (data) {
        return articleResource('post','saveArticle',null,data)
    },
    deleteArticle:function (id) {
        return articleResource('delete',id,'deleteArticle',null)
    }
}